Skip to content

fix(mobile): open threads at the newest reply, with a shared jump-to-latest pill - #5364

Open
NuCl34R wants to merge 2 commits into
block:mainfrom
NuCl34R:mobile-thread-open-at-tail
Open

fix(mobile): open threads at the newest reply, with a shared jump-to-latest pill#5364
NuCl34R wants to merge 2 commits into
block:mainfrom
NuCl34R:mobile-thread-open-at-tail

Conversation

@NuCl34R

@NuCl34R NuCl34R commented Aug 9, 2026

Copy link
Copy Markdown

Summary

Opening a thread on mobile lands on the thread head. In agent-heavy channels where threads routinely reach 300+ replies, reaching the newest message takes dozens of scroll gestures. Desktop's thread panel already opens at the bottom.

Two commits:

  1. fix: open threads scrolled to the newest reply. Once the authoritative thread query hydrates, jump to the last reply, then align its trailing edge with the viewport bottom in a second pass (the tail must render before its extent is measurable). Guard rails:
    • Deep links win: initialMessageId keeps its existing jump and takes precedence over the tail jump.
    • Short threads keep their top anchoring: when the tail is already on screen, no scroll happens at all.
  2. feat: jump-to-latest pill in threads. The channel timeline's frosted "Latest" pill now also appears in threads when the newest reply scrolls out of view; tapping it animates back to the tail. The pill is extracted into a shared, documented JumpToLatestButton used by both surfaces (net deduplication). _ThreadMessage/_Avatar move to a part file to keep thread_detail_page.dart under the 1000-line guard.

Related issue

Fixes #4354.

Closest existing PRs (searched before opening):

No intent to race either one — happy to rebase on top if maintainers prefer to land one of those first, or to fold this PR's tests and pill onto it.

Testing

TDD: each behavior landed with a widget test written first and observed failing. New/updated tests in channel_detail_page_test.dart:

  • thread opens scrolled to the newest reply — 40-reply thread opens with the tail visible, head unbuilt
  • initial thread hydration lands on the newest reply — same, with delayed (Completer-driven) hydration
  • thread deep link still lands on the linked reply — deep-link precedence over the tail jump
  • thread shows a Latest pill when scrolled up that jumps back to the newest reply — pill appears on scroll-up, returns to the tail on tap, hides at the tail

Full mobile suite: 1264/1264 green; just mobile-check clean (analyze, format, file-size guard). Both commits are DCO signed.

On device: validated on a Galaxy S23 Ultra debug build against a production relay — long agent threads (300+ replies) open on the newest reply, the pill appears on scroll-up and returns to the tail, deep links and short threads behave as before. Screenshots to follow in a comment.

🤖 Generated with Claude Code

NuCl34R added 2 commits August 8, 2026 20:38
Opening a thread on mobile landed on the thread head, forcing users to
scroll through potentially hundreds of replies to reach the newest
message. Desktop's thread panel already opens at the bottom.

Once the authoritative thread query hydrates, jump to the last reply and
align its trailing edge with the viewport bottom, then keep following
the tail. Deep links to a specific reply keep their existing behavior
and take precedence over the tail jump; short threads whose tail is
already visible are left alone.

Fixes block#4354

Signed-off-by: NuCl34R <nukecl34r@gmail.com>
Scrolling up in a long thread left no quick way back to the newest
reply. Reuse the channel timeline's frosted Latest pill in the thread
detail page: it appears when the newest reply scrolls out of view and
animates back to the tail on tap.

The pill widget is extracted from the channel message list into a
shared public JumpToLatestButton used by both surfaces. _ThreadMessage
and _Avatar move to a part file to keep thread_detail_page.dart under
the 1000-line ceiling.

Signed-off-by: NuCl34R <nukecl34r@gmail.com>
@NuCl34R
NuCl34R requested a review from a team as a code owner August 9, 2026 01:15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e84005e67

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +163 to +165
final targetAlignment =
1.0 - (lastPosition.itemTrailingEdge - lastPosition.itemLeadingEdge);
itemScrollController.jumpTo(index: lastIndex, alignment: targetAlignment);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Account for the composer when aligning the tail

When a member opens a long thread after the composer dock has already been measured, this alignment places the newest reply's trailing edge at the physical bottom of the list viewport. Because the composer is overlaid on that same viewport and the list's bottom padding can be scrolled offscreen, a typical short newest reply can end up entirely behind the composer; the dock-height callback does not correct this when its height was already known. Align against the usable boundary above composerDockHeight (and the gutter), rather than 1.0.

Useful? React with 👍 / 👎.

@NuCl34R

NuCl34R commented Aug 9, 2026

Copy link
Copy Markdown
Author

Here's an image of the pill to navigate to the latest comment.

Screenshot_20260808_211815_Buzz (8e84005e6).jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile: threads open at the top instead of the newest reply (desktop opens at bottom)

1 participant